<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var str = "故事的结尾，水中月，心上人";
        console.log (overHidden(str));
        function overHidden(string){
            if(string.length>5){
                return string.slice(0,5)+"...";
            }
            return string;
        }
    </script>
</body>
</html>